<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>ES6对象方法扩展</title>
</head>
<body>
  
</body>
<script>
  // 1、Object.is 判断两个值是否完全相等
  console.log(Object.is(120, 120));
  console.log(Object.is(NaN, NaN));
  console.log(NaN === NaN);
  
  // 2、Object.assign 对象的合并
  const config1 = {
    host: 'localhost',
    port: 3306,
    name: 'root',
    pass: 'root'
  }
  const config2 = {
    host: 'http://www.xxx.com',
    port: 33060,
    name: 'zhangsan',
    pass: '123456'
  }

  console.log(Object.assign(config1, config2)); // 如果遇到参数重名，后面的对象会覆盖签名的参数

  // 3、Object.setPrototypeOf 设置对象原型 Object.getPrototypeOf
  const school = {
    name: '小学'
  }
  const cities = {
    xiaoqu: ['beijing', 'shanghai', 'shenzhen']
  }
  Object.setPrototypeOf(school, cities);
  console.log(Object.getPrototypeOf(school));
  console.log(school);
</script>
</html>